﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OthelloGame
{
    public class OthelloBoardLocation
    {
        private int horizontalPlacement;
        private int verticalPlacement;

        public int HorizontalPlace
        {
            get
            {
                return horizontalPlacement;
            }
            set
            {
                horizontalPlacement = value;
            }
        }
        public int VerticalPlace
        {
            get
            {
                return verticalPlacement;
            }
            set
            {
                verticalPlacement = value;
            }
        }

        public OthelloBoardLocation(int newHorizontalPlacement, int newVerticalPlacement)
        {
            horizontalPlacement = newHorizontalPlacement;
            verticalPlacement = newVerticalPlacement;
        }

        #region equals
        // override object.Equals
        public override bool Equals(object obj)
        {

            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }
            else if (obj.GetHashCode() != GetHashCode())
            {
                return false;
            }
            return true;
        }

        // override object.GetHashCode
        public override int GetHashCode()
        {
            int hash = 1;
            int prime = 31;
            hash = hash * prime + this.horizontalPlacement.GetHashCode();
            hash = hash * prime + this.verticalPlacement.GetHashCode();
            return hash;
        }
        #endregion

        public override string ToString()
        {
            return HorizontalPlace.ToString() + " : " + VerticalPlace.ToString();
        }
    }
}
